//随机产生20个[77~459）正整数存放到数组中，求数组的最大值、最小值、平均值及各个元素之和
import java.util.Scanner;
import java.util.Random;
public class Class6{
	public static void main(String args[]){
	Random r=new Random();
	int a[]=new int[20];
	int i=0,sum=0,max,temp,min,average,n=20;
	for(i=0;i<20;i++){
	a[i]=r.nextInt(382)+77;}
	for(i=0;i<n-1;i++){
	if(a[i]<a[i+1]) {
	temp=a[i];a[i]=a[i+1];a[i+1]=temp;}
	}
	min=a[i];
System.out.println("最小值为："+min);
for(i=0;i<n-1;i++){
	if(a[i]>a[i+1]) {
	temp=a[i];a[i]=a[i+1];a[i+1]=temp;}
	}
	max=a[i];
System.out.println("最大值为："+max);
	for(i=0;i<n;i++){
	sum=sum+a[i];}
System.out.println("总和为："+sum);
average=sum/20;
System.out.println("平均值为："+average);
}
}